import request from '@/utils/request'

// 查询车辆列表
export function listVehicles(query) {
  return request({
    url: '/bus/vehicles/list',
    method: 'get',
    params: query
  })
}

// 查询车辆详细信息
export function getVehicle(id) {
  return request({
    url: '/bus/vehicles/' + id,
    method: 'get'
  })
}

// 新增车辆
export function addVehicle(data) {
  return request({
    url: '/bus/vehicles',
    method: 'post',
    data: data
  })
}

// 修改车辆信息
export function updateVehicle(data) {
  return request({
    url: '/bus/vehicles',
    method: 'put',
    data: data
  })
}

// 删除车辆
export function delVehicle(id) {
  return request({
    url: '/bus/vehicles/' + id,
    method: 'delete'
  })
}

// 获取调度系统车辆数据（包含实时位置、状态等）
export function getDispatchVehicles() {
  return request({
    url: '/bus/vehicles/dispatch',
    method: 'get'
  })
}

// 获取车辆实时位置
export function getVehicleRealTimeLocation() {
  return request({
    url: '/bus/vehicles/realtime',
    method: 'get'
  })
}

// 更新车辆位置（模拟GPS上报）
export function updateVehicleLocation(data) {
  return request({
    url: '/bus/vehicles/location',
    method: 'post',
    data: data
  })
}

// 获取车辆运营统计
export function getVehicleStats() {
  return request({
    url: '/bus/vehicles/stats',
    method: 'get'
  })
}